/*
** my_getnbr.c for  in /home/vanet_c//piscine/Jour_04
** 
** Made by charles-edouard vanet
** Login   <vanet_c@epitech.net>
** 
** Started on  Thu Oct  4 11:02:52 2012 charles-edouard vanet
** Last update Tue Dec 11 19:51:38 2012 charles-edouard vanet
*/

int     my_getnbr(char *str)
{
  int   nbr;
  int   nbr2;
  int   i;

  nbr = 0;
  i = 0;
  while (*str == '-' || *str == '+')
    str = str + 1;
  while (*str >= '0' && *str <= '9')
    {
      nbr2 = nbr * 10;
      nbr = (*str - '0') + nbr2;
      str = str + 1;
      i = i + 1;
      if (nbr < 0)
        return (0);
    }
  str = str - (1 + i);
  while (*str == '-' || *str == '+')
    {
      if (*str == '-')
        nbr = nbr * (-1);
      str = str - 1;
    }
  return (nbr);
}
